//引用axios所需要组件
import axios from 'axios'
import {developUrl,serverDK} from './api';

// 智能数据交换云平台地址
export const dataExchangeHost = developUrl+serverDK;

//封装axios
export const axiosDataFun = (method,url,dataParam) => {
    return axios({
        headers: {
            'Content-Type': 'application/json'
        },
        method: method,
        url: url,
        data: dataParam
    }).then(res => res).catch( error => error )
}

//组织信息列表添加
export const organizationDataExchangeAdd = (param) => {
    return axiosDataFun('post', dataExchangeHost+'organization/save', param).then(res => res);
}

//组织信息列表删除
export const organizationDataExchangeDel = (param,id) => {
    return axiosDataFun('get', dataExchangeHost+'organization/'+id+'/del', param).then(res => res);
}

//组织信息列表和查询
export const organizationDataExchangeListSearch = (param) => {
    return axiosDataFun('post', dataExchangeHost+'organization/search', param).then(res => res);
}

//组织信息列表详细内容
export const organizationDataExchangeListDetail = (param,id) => {
    return axiosDataFun('get', dataExchangeHost+'organization/detail/'+id, param).then(res => res);
}

//组织信息列表更新
export const organizationDataExchangeUpdata = (param) => {
    return axiosDataFun('post', dataExchangeHost+'organization/update', param).then(res => res);
}

//组织信息区域列表
export const organizationDataExchangeQuyu = (param) => {
    return axiosDataFun('post',dataExchangeHost+'area/search',param).then(res => res);
}

